/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$(function(){
    $('#tj').click(function(){
        var jzr = $('#jzr').val();
        var jzrq = $('#jzrq').val();
        var jzje = $('#jzje').val();
        var lxfs = $('#lxfs').val();
        if(jzr==""||jzr==null){
            $.toast("借支人不能为空！", "forbidden");
            return;
        }
        if(lxfs==""||lxfs==null){
            $.toast("手机号不能为空！", "forbidden");
            return;
        }else{
            if(!(/^1[34578]\d{9}$/.test(lxfs))){
                $.toast("手机号格式不正确！", "forbidden");
                return;
            }
            
        } 
        if(jzrq==""||jzrq==null){
            $.toast("借支日期不能为空！", "forbidden");
            return;
        }
        if(jzje==""||jzje==null){
            $.toast("借支金额不能为空！", "forbidden");
            return;
        }
        
        $.showLoading();
        var o = new AjaxOptions('#form_data');
        o.put('service_code', 'P90012');
        o.sus = function (data) {
            $.hideLoading();
            var sj = Math.random();
            $.toast("操作成功");
            window.location.href = window.location.href + sj;
        };
        o.fal = function (code, desc) {
            $.hideLoading();
            if (code == "9001201") {
                $.toast("借支信息保存失败！", "forbidden");
            }
        };
        $.ajax(o);
        
    });
    
    
});
